// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router/index1'
import Vuex from 'vuex'
import store from './store/index'
import ElementUi from 'element-ui'
//       import 'element-ui/lib/theme-default/index.css'
import 'element-ui/lib/theme-chalk/index.css'
import axios from 'axios'
import './config/utils.js'
import $ from '@/assets/js/common'
import echarts from 'echarts'
// require('../node_modules/vux/src/styles/reset.less');

import  VueQuillEditor from 'vue-quill-editor'
// require styles 引入样式
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'

Vue.use(VueQuillEditor)

Vue.config.productionTip = false

Vue.prototype.$echarts = echarts
Vue.use(ElementUi)
Vue.use(Vuex)
Vue.prototype.axios = axios
Vue.prototype.$ = $
/* eslint-disable no-new */

new Vue({
  el: '#app',
  router,
  store,
  beforeCreate () {
			if((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) {
				// alert('手机端')
				this.$store.state.gnlist.pcqh = false;
			} else {
				// alert('移动端')
			}
//		</script>
  	console.log("beforeCreate")
  },
  created () {
      console.log('create')
  },
  template: '<App/>',
  components: { App }
}),



router.beforeEach((to,from,next) => {
//	console.log(to,888889999999999)
    if(to.matched.some( m => m.meta.auth)){
        // 对路由进行验证
//      alert(1111)
//      if(store.state.isLogin>0) { // 已经登陆
//      		if(localStorage.logininfo){
//      			next()
//      		}else{
//      			next({path:'/' })  
//      		}
//      }else{
//          // 未登录,跳转到登陆页面，并且带上 将要去的地址，方便登陆后跳转。
////          next({path:'/',query:{ referrer: to.fullPath} })  
//          next({path:'/' })  
////          this.$message("数据更新，请重新登录！");
//						alert("数据更新，请重新登录！")
//      }
        next()
    }else{
        next()
    }
})
